package cn.icatw.gulimall.seckill.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author icatw
 * @date 2022/3/13
 * @email 762188827@qq.com
 * @apiNote Redisson配置
 */
@Configuration
public class MyRedissonConfig {
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() throws IOException {
        // 默认连接地址 127.0.0.1:6379

        Config config = new Config();
        config.useSingleServer().
                setAddress("redis://192.168.17.131:6379");
        return Redisson.create(config);
    }

}
